<!DOCTYPE html>
<html style="height: 100%">
<head>
    <title>活动首页</title>
    <% include ../../layouts/import.ejs %>
</head>
<body style="height: 100%">

<% include ../../layouts/header.ejs %>
<% include ../../layouts/processHeader.ejs %>

    <div class="height" style="background: #F8F6F2;">
        <div class="container " role="navigation">

            <div class="feedBack-list">
                <div id="activityToolbar" class="btn-group" role="group" aria-label="...">
                    <button type="button" class="btn btn-default" id="activityAdd">添加</button>
                </div>
                <div class="clearfix"></div>
                <table id="feedBackDataTable" class="feedBack-list-table">

                </table>
            </div>

        </div>
    </div>
<% include ../../layouts/footer.ejs %>
</body>

<script>

    $("#feedBack").addClass("click-change")

    var feedBackDataTable = $('#feedBackDataTable').bootstrapTable({
        columns: [
            {
                field: 'checkbox',
                checkbox: true,
                width: '5%'
            }, {
                field: 'feed_back_title',
                title: '反馈标题',
                width: '35%'
            }, {
                field: 'feed_back_time',
                align: 'center',
                title: '反馈日期',
                width: '35%'
            }, {
                field: 'feed_back_person',
                align: 'center',
                title: '反馈人',
                width: '15%'
            }, {
                field: 'Button',
                title: '操作',
                width: '10%',
                valign: 'middle',
                align: 'center',
                formatter: function (value, row, index) {
                    var id = row.id;
                    var result = "";
                    result += "<a href='/process/feedBack/edit/"+ id +"' class='btn btn-xs blue'   title='编辑'><span class='glyphicon glyphicon-pencil'></span></a>";
                    result += "<a href='javascript:;' class='btn btn-xs red'  onclick=\"deleteById('" + id + "')\" title='删除'><span class='glyphicon glyphicon-remove'></span></a>";

                    return result;
                }
            }
        ],
        striped: true,
        showExport: true,                     //是否显示导出
        exportDataType: "basic",              //basic', 'all', 'selected'.
        showToggle: true,
        pagination: true,
        pageNumber: 1,
        pageSize: 15,
        pageList: [5, 10, 15, 20],
        search: true,
        toolbar: '#activityToolbar',
        url: '/process/feedBack/listByFeedBack'
    });

    $('#activityAdd').click(function () {
        location.href = '/process/feedBack/add';
    });



    function deleteById(id) {
        if (id) {
            $.post('/process/feedBack/delete/' + id, function (result) {
                console.log(result.errcode)
                if (result.errcode === 0) {
                    $('#feedBackDataTable').bootstrapTable(
                        'refresh',
                        {
                            silent: true,
                            url: '/process/feedBack/listByFeedBack'
                        }
                    );
                } else {
                    console.error(result.message);
                }
            })
        } else {
            return false;
        }
    }


</script>
</html>